package dk.hewison.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.*;
import dk.hewison.client.menu.MainMenuController;
import dk.hewison.client.mvc.Register;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class GetMyStuff implements EntryPoint {


    /**
     * This is the entry point method.
     */
    public void onModuleLoad() {

        GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
            public void onUncaughtException(Throwable e) {
                e.printStackTrace();
                Window.alert(e.toString());
            }
        });

        Window.enableScrolling(false);
        Window.setMargin("0px");


        FocusPanel focusPanel = new FocusPanel(MediaAppController.getInstance().getView().getMyWidget());
        focusPanel.addKeyboardListener(new KeyboardListenerAdapter() {
            public void onKeyDown(Widget sender, char keyCode, int modifiers) {
                if (KeyboardListener.MODIFIER_ALT == modifiers) {
                    if (keyCode == 'D' || keyCode == 'L') {
                        Log.showLog();
                    }
                }
            }
        });

        //RootPanel.get().add(NetlAppController.getInstance().getView().getMyWidget());

        // Add the panel to the Root Panel
        RootPanel.get().add(focusPanel);

        Register.getInstance().eventOccurred(new AppEvent<Integer>(AppEvent.Event.PAGE_SELECTED, MainMenuController.ALL_ALBUMS));


    }
}
